package com.zhiyou.test01.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.zhiyou.test01.model.UserModel;
import com.zhiyou.test01.service.IUserService;

@Controller
@RequestMapping("/user")
public class UserController {

	@Autowired
	IUserService userService;

	@RequestMapping("/index.do")
	public String index(Model model){

		List<UserModel> userModels = userService.queryUser();

		model.addAttribute("userModels", userModels);

		return "index";
	}

	@RequestMapping(value="submitB.do",method=RequestMethod.POST)
	public String  aaa(String[] checkid,HttpServletRequest request,Model model){
		for (String string : checkid) {
			System.out.println("提交的数据："+string);
		}
		List<UserModel> userModels = userService.queryUser();

		model.addAttribute("userModels", userModels);
		String pair = request.getServletContext().getRealPath("/");
		model.addAttribute("pair", pair);

		return "index";
	}
}
